import {onMounted, ref} from 'vue'
import type {Banner} from "@/types/home";
import {getHomeBannerAPI} from "@/apis/home";
import type {ResponseData} from "@/types/user";

export const useBanner = () => {
  const bannerList = ref<Banner[]>([])
  const getHomeBannerData = async () => {
    const res = await getHomeBannerAPI({distributionSite: 2}) as ResponseData<Banner[]>
    bannerList.value = res.result
  }

  onMounted(() =>
    getHomeBannerData()
  )
  return {bannerList}
}